home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 7: Sunsite / Linux Cubed Series 7 - Sunsite Vol 1.iso / system / network / manageme / tcpdump-.001 / tcpdump-~ / tcpdump-3.0.2-linux / libpcap-0.0.6 / configure < prev    next >
Encoding:
Text File  |  1995-09-30  |  3.2 KB  |  123 lines

  1. #!/bin/csh -f
  2. set bison
  3. set ethers
  4. set flex
  5. set gcc
  6. set gcc1
  7. set pcap
  8. set ranlib
  9. set brokenmake
  10. if ( -e /dev/bpf0 ) then
  11.     set pcap=bpf
  12. else if ( -f /usr/include/net/pfilt.h ) then
  13.     set pcap=pf
  14. else if ( -e /dev/enet ) then
  15.     set pcap=enet
  16. else if ( -e /dev/nit ) then
  17.     set pcap=snit
  18. else if ( -f /usr/include/sys/net/nit.h ) then
  19.     set pcap=nit
  20. else if ( -f /usr/include/net/raw.h ) then
  21.     set pcap=snoop        # must test for snoop before dlpi due to IRIX
  22. else if ( -f /usr/include/sys/dlpi.h ) then
  23.     set pcap=dlpi
  24. else if ( -f /usr/include/linux/types.h ) then
  25.     set pcap=linux
  26. else
  27.     echo "configure: cannot determine packet capture interface"
  28.     exit 1
  29. endif
  30. echo "configure: using $pcap packet capture interface"
  31. if ( -x /bin/uname || -x /usr/bin/uname ) then
  32.     set name=`uname -s | tr '[A-Z]' '[a-z]'`
  33.     set vers=`uname -r | sed -e 's/\..*//' -e 's/T1/v1/' | tr '[A-Z]' '[a-z]'`
  34.     if ( "$name$vers" == "sunos5") then
  35.         set path=($path /usr/ccs/bin)
  36.     endif
  37. else if ( -x /bin/arch ) then
  38.     # sun3 only supported machine without uname
  39.     if ( `/bin/arch` == sun3 ) then
  40.         set name=sunos
  41.         set vers=3
  42.     endif
  43. endif
  44. if ( $name == "bsd/386" || $name == "bsd/os" ) then
  45.     set os=bsd
  46. else
  47.     set os=$name$vers
  48. endif
  49. if ( -x /usr/local/bin/flex || -x /usr/local/flex ) then
  50.     # The -V flag was added in 2.4
  51.     flex -V >& /dev/null
  52.     if ($status == 0) then
  53.         set flex='-e s/^#have-flex#//'
  54.         echo "configure: found flex executable"
  55.     else
  56.         set s="version 2.4 or higher required"
  57.         echo "configure: ignoring obsolete flex executable ($s)"
  58.     endif
  59. else
  60.     echo "configure: couldn't find flex executable; using lex"
  61. endif
  62. if ( -x /usr/local/bin/bison || -x /usr/local/bison ) then
  63.     set bison='-e s/^#have-bison#//'
  64.     echo "configure: found bison executable"
  65. else
  66.     echo "configure: couldn't find bison executable; using yacc"
  67. endif
  68. if ( ( "$flex" == "" && "$bison" != "" ) || \
  69.      ( "$flex" != "" && "$bison" == "" ) ) then
  70.     set s="reverting to lex/yacc"
  71.     echo "configure: don't have both flex and bison; $s"
  72.     set flex
  73.     set bison
  74. endif
  75. set libc
  76. foreach f ( /usr/lib/libc.a /lib/libc.a /usr/lib/libc_s.a )
  77.     if ( -f $f ) then
  78.         set libc=$f
  79.         break
  80.     endif
  81. end
  82. if ( "$f" == "" ) then
  83.     echo "configure: couldn't find libc"
  84. else
  85.     nm $libc |& grep ether_ntoa > /dev/null
  86.     if ( $status == 0 ) then
  87.         set ethers='-e s/^#have-ethers#//'
  88.         echo "configure: found support for /etc/ethers"
  89.     endif
  90. endif
  91. if ( -x /usr/local/bin/gcc || -x /usr/local/gcc ) then
  92.     set gcc='-e s/^#have-gcc#//'
  93.     set ver=`gcc -v |& sed -n -e '$s/.* //' -e '$s/\..*//p'`
  94.     if ( "$ver" == 1 ) set gcc1='-e s/^#have-gcc1#//'
  95. endif
  96. if ( -x /usr/bin/ranlib ) then
  97.     set ranlib='-e s/^#have-ranlib#//'
  98. endif
  99. if ("$os" == "ultrix4" || "$os" == "sunos3") then
  100.     set brokenmake='-e s/^#have-broken-make#//'
  101. endif
  102. rm -f stdlib.h Makefile
  103. if ( ! -f /usr/include/stdlib.h ) ln -s /dev/null stdlib.h
  104. sed -e "s/^#have-$pcap#//" -e "s/^#have-$os#//" \
  105.     $flex $bison $gcc $gcc1 $ranlib $ethers $brokenmake Makefile.in > Makefile
  106. set mflags=""
  107. if ( "$gcc" != "" ) then
  108.     set mflags="CC=gcc"
  109.     rm -f checkioctl
  110.     make checkioctl
  111.     ./checkioctl
  112.     set xstatus=$status
  113.     rm checkioctl
  114.     if ( $xstatus != 0 ) then
  115.         echo "configure: bailing..."
  116.         rm Makefile
  117.         exit 1
  118.     endif
  119. endif
  120. chmod ug+w Makefile
  121. make depend $mflags
  122. exit 0
  123.